package cn.xt.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

    // 商户appid
    public static String APPID = "2016091600524746";
    // 私钥 pkcs8格式的
    public static String RSA_PRIVATE_KEY = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC5hFXFYa4tF4REVMIUI3Fpj1FXvmJNStc7JoR3MoXEd7MM4DrA4mIE9nhsvdqWWWrflJXD2VNOci8rKNFRc5f96ArU6P0k+vHbhQNsFrru2t3G2aOAEtifi10S+CHZFsW0JA+ljaxn65UrExOz3Iknfmt4IfZ7E3ZdVn4FwntKvy7MiIzJ3zEYwJpa/wIEYF2MqJhDUF/47y3F4LhYHu7aaHtY+vu/cBvw/67TDUQAnLscR8lMiZ5ApftMevYEdefo4ITxHj5oWGM6Un9yf/vZluHhIIhsgn8ufZ4jKyQOL87TVZ/bA0RwFtp9ACxIxmT3WxZec58zcvzgKelAI01JAgMBAAECggEBAIsPJE/ZIXtRZmbl9bisvKV4tWuFHSB82grPm3nR2C1l4EPljITq7Lh1m90/DqumiRLgyMZOkEB8HNlINmbMtACyP/RKVP60UDjRYrhR7Xt/ecBFgWZOOiyVhYXjk1Or2zRl14isQrB/CYiJOzqWNATzoVEifCTTeOUMIVjl6A8lKACTqO+LY/rtpyXWHBR/7lJ4mnwww5YOwtxXf4VkjBbXUJljgnp0vLzWMB07UFHi3uWavPy6pkLxW1i4GFG6hvw8EhNCx/kFcOjngYL+/RlNih1QmPpBFn8u3JZngcJX3i0gMa8aUwEpqCnvbk9UUVp/CfLZDs7kO9/QwDr2ZmUCgYEA+fT/mE1I42K8i5bfFEmZZTOvi9qHFH8IjHnnaacqEynkXk/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Myd8xGMCaWv8CBGBdjKiYQ1Bf+O8txeC4WB7u2mh7WPr7v3Ab8P+u0w1EAJy7HEfJTImeQKX7THr2BHXn6OCE8R4+aFhjOlJ/cn/72Zbh4SCIbIJ/Ln2eIyskDi/O01Wf2wNEcBbafQAsSMZk91sWXnOfM3L84CnpQCNNSQIDAQAB";
    // 服务器异步通知页面路径 需http://或者https://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://120.78.67.10:8083/mavensmbms/order/alipayNotifyNotice";
    // 页面跳转同步通知页面路径 需http://或者https://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问 商户可以自定义同步跳转地址
    public static String return_url = "http://120.78.67.10:8083/mavensmbms/order/alipayReturnNotice";
    // 请求网关地址
    public static String URL = "https://openapi.alipaydev.com/gateway.do";
    // 编码
    public static String CHARSET = "utf-8";
    // 返回格式
    public static String FORMAT = "json";
    // 日志记录目录
    public static String log_path = "/log";
    // RSA2
    public static String SIGNTYPE = "RSA2";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

